home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Games / WHDLoad / Src / sources / whdload / blitfix_imm_58a6.s < prev    next >
Encoding:
Text File  |  2000-08-07  |  1.8 KB  |  79 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Program.    blitfix_imm_58a6.s
  3. ;  :Contents.    routine to fix program that does not correctly wait for
  4. ;        blitter finish
  5. ;        the instruction which writes the "bltsize" register will be
  6. ;        patched with a routine which will wait for blitter finish
  7. ;        after writing "bltsize"
  8. ;  :Version.    $Id: blitfix_imm_58a6.s 1.4 2000/04/16 16:46:17 jah Exp $
  9. ;  :History.    30.08.97 extracted from Turrican slave
  10. ;        19.03.99 checked area fixed, a2 now returns pointer
  11. ;        09.04.00 interrupt blit check added
  12. ;  :Requires.    -
  13. ;  :Copyright.    Public Domain
  14. ;  :Language.    68000 Assembler
  15. ;  :Translator.    Barfly V1.131
  16. ;  :To Do.
  17. ;---------------------------------------------------------------------------*
  18. ;
  19. ; this will patch the following instruction:
  20. ;        move.w    #XXXX,($58,a6)
  21. ;
  22. ; IN:    A0 = APTR start of memory to patch
  23. ;    A1 = APTR end of memory to patch
  24. ;    A2 = APTR space for patch routine MUST be < $8000 !!!
  25. ;          required are 6 bytes (8 bytes with PATCHCOUNT)
  26. ; OUT:    D0-D1/A0-A1 unchanged
  27. ;    A2 = APTR points to the end of patch routine
  28.  
  29. _blitfix_imm_58a6
  30.         movem.l    a0-a1,-(a7)
  31.  
  32.     IFD PATCHCOUNT
  33.         clr.w    (6,a2)            ;counter = 0
  34.     ENDC
  35.  
  36.         subq.l    #4,a1
  37. .loop        cmp.w    #$3d7c,(a0)+        ;move.w #xxxx,($xxxx,a6)
  38.         bne    .next
  39.         cmp.w    #$0058,(2,a0)
  40.         bne    .next
  41.         move.w    (a0),(2,a0)        ;save blitsize
  42.         subq.w    #2,a0
  43.         move.w    #$4eb8,(a0)+        ;JSR $xxxx.w
  44.         move.w    a2,(a0)+
  45.  
  46.     IFD PATCHCOUNT
  47.         addq.w    #1,(6,a2)
  48.     ENDC
  49.  
  50. .next        cmp.l    a0,a1
  51.         bhs    .loop
  52.  
  53.         move.w    #$4ef9,(a2)+        ;JMP $xxxxxxxx.l
  54.         lea    (.movewait),a0
  55.         move.l    a0,(a2)+
  56.  
  57.     IFD PATCHCOUNT
  58.         addq.l    #2,a2
  59.     ENDC
  60.  
  61.         movem.l    (a7)+,a0-a1
  62.         rts
  63.  
  64. .movewait    move.l    a0,-(a7)
  65.         move.l    (4,a7),a0
  66.         move.w    (a0)+,($58,a6)
  67.         move.l    a0,(4,a7)
  68.         move.l    (a7)+,a0
  69.         BLITWAIT a6
  70.     IFD INTBLITCHECK
  71.         move.l    d0,-(a7)
  72.         move    sr,d0
  73.         and.w    #$0700,d0
  74.         beq    .intok
  75.         illegal
  76. .intok        move.l    (a7)+,d0
  77.     ENDC
  78.         rts
  79.